Mathematical Operations and Elementary Functions

Arithmetic Operations


In [20]:
workspace()
x = 3
y = 2

z= x + y
r = x - y
t = x * y
u = x / y
q = x\y
p = x ^ y
println("$x+$y = $z")
println("$x-$y = $r")
println("$x*$y = $t")
println("$x/$y = $u")
println("$x \ $y = $q")
println("$x^$y = $p")


3+2 = 5
3-2 = 1
3*2 = 6
3/2 = 1.5
3  2 = 0.6666666666666666
3^2 = 9

Complex numbers


In [21]:
com = 1 + 2im 
com2 = 3 + 5im
com3 = com + com2


Out[21]:
4 + 7im

Rational Numbers


In [22]:
rat = 2 // 3
rat2 = 5 // 6
rat3 = rat * rat2


Out[22]:
5//9

In [ ]: